<template>
  <div class="footer">
    <input type="checkbox">
    <span>已完成{{doneTotal}}/全部{{todos.length}}</span>
    <div class="btn">清除已完成任务</div>
  </div>
</template>

<script>
export default {
  name: 'MyFooter',
  props: ['todos'],
  computed: {
    doneTotal () {
      let i = 0
      this.todos.forEach(todo => {
        if (todo.isChecked == true) i++
      });
      return i
    }
  }
}
</script>

<style scoped>
.footer {
  position: relative;
  width: 400px;
  height: 40px;
  padding: 10px 10px;
  /* background-color: yellow; */
  line-height: 40px;
}
span {
  padding-left: 10px;
}
.footer .btn {
  position: absolute;
  right: 0;
  top: 20px;
  background-color: red;
  border-radius: 5px;
  height: 30px;
  line-height: 30px;
  padding: 0 5px;
  color: #fff;
  cursor: pointer;
}
</style>
    